package com.swt.draw.service.impl;

import com.swt.draw.dao.AdminMapper;
import com.swt.draw.entity.Admin;
import com.swt.draw.example.AdminExample;
import com.swt.draw.service.AdminService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName
 * @Description TODO
 * @Author Administrator
 * @Date 2019/9/20 0020 22:53
 * @Version 1.0
 **/
@Service("adminService")
public class AdminServiceImpl implements AdminService {

    @Resource
    private AdminMapper adminMapper;

    @Override
    public Integer addAdmin(Admin admin) {
        return adminMapper.insertSelective(admin);
    }

    @Override
    public List<Admin> getAdminByLoginName(String loginName) {
        AdminExample example = new AdminExample();
        AdminExample.Criteria criteria = example.createCriteria();
        criteria.andAdminLoginNameEqualTo(loginName);
        return adminMapper.selectByExample(example);
    }
}
